package com.docker.core.third.docker;

import org.apache.log4j.Logger;

/**
 * @Author ldl
 * @Create 2020/12/02 002 16:23
 */
public class DockerTidyThread implements Runnable {

    private static final Logger logger = Logger.getLogger(DockerTidyThread.class);

    public static boolean start() {
        //启动n个线程
        int count = 1;
        for (int i = 0; i < count; i++) {
            DockerTidyThread myThread = new DockerTidyThread();
            Thread thread = new Thread(myThread);
            thread.start();
        }
        return true;
    }

    @Override
    public void run() {
        while (true) {
            try {
                DockerKit.tidy();
                Thread.sleep(60000);//每分钟刷新一次连接池
            } catch (Exception e) {
                logger.error("docker服务连接池处理失败", e);
            }
        }
    }

}
